// created by jimmy 2016/2/17
var value = "";
$(document).ready(function() {
    /*获取焦点*/
    $(".index-banner .search-input").focus(function() {
        $(this).parents(".index-search").css({ "background-color": "rgba(0,0,0,0.5)" });
    });
    /*失去焦点*/
    $(".index-banner .search-input").blur(function() {
        $(this).parents(".index-search").css({ "background-color": "rgba(0,0,0,0.2)" });
    });

    $(".search-icon").click(function() {
        value = $(this).siblings(".search-input").val();
        a(value);

    });

    $(".search-input").keyup(function(e) {

        if (e && e.preventDefault)
            e.preventDefault();
        //IE中阻止函数器默认动作的方式
        else
            window.event.returnValue = false;


        if (e.keyCode == 13) {

            value = $(this).val();

            a(value);
        }
    });
})

function a(value) {
    if (value.length > 0) {

        var pp = parseInt(Math.random()*10000000000000000);
        window.location.href = "../../../search/searchResult-random=.htm"/*tpa=http://www.quyundong.com/search/searchResult?random=*/ + pp + "&search_text=" +  encodeURIComponent(value) ;
    } else
        alert("请输入球馆关键字");
}
